//
//  TSAlertTool.m
//  tryshopping.boss
//
//  Created by Mr.Lee on 16/11/11.
//  Copyright © 2016年 Reabam. All rights reserved.
//

#import "TSAlertTool.h"

@implementation TSAlertTool

+(void)showAlertMessage:(NSString *)message{
    [self ShowContentString:message];
}

+ (void)showAlertWait;
{
    
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"网络不稳定哦 ！" message:@"请确认网络" preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
    }]];
    [self  presentViewController:alert];
}



+(void)ShowContentString:(NSString *)content{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:content preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
    }]];
    [self  presentViewController:alert];
}

+(void)ShowAlertWithTitleString:(NSString*)title andContentString:(NSString*)content andButtonTitle:(NSString *)btnTitle andDoAction:(void(^)())doAction{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:content preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:btnTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
        if (doAction) {
            doAction();
        }
    }]];
    [self  presentViewController:alert];
}


+(void)ShowOralNetFail{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"网络原因" preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
    }]];
    [self  presentViewController:alert];
}


+(void)ShowOralAlertWithTitleString:(NSString *)title andContentString:(NSString *)content{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:content preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
    }]];
    [self  presentViewController:alert];
}



+(void)ShowAlertWithTitleString:(NSString*)title andContentString:(NSString*)content andButtonTitle:(NSString *)btnTitle{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:content preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:btnTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
    }]];
    [self  presentViewController:alert];
}



+(void)presentViewController: (UIViewController*)vController
{
    UIViewController* rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
    [rootViewController presentViewController: vController  animated: YES completion:nil];
}

@end
